{% extends 'base.html' %}

{% block content %}

    <!-- Plugins css-->


    <link href="/static/assets/plugins/bootstrap-select/dist/css/bootstrap-select.min.css" rel="stylesheet" />


<div class="container">
        <div class="row ">
                    <div class="col-sm-12">
                        <h4 class="page-title">主机修改</h4>
                        <ol class="breadcrumb">
                            <li>
                                <a href="#">容器管理</a>
                            </li>
                            <li class="active">
                                <a href="{% url 'DockerHosts' %}">主机列表</a>
                            </li>
                        </ol>
                    </div>

            <form class="form-horizontal" role="form" method="POST" action="{% url 'DockerHostEdit' hostid %}">
                    {% csrf_token  %}
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="card-box">
                                <div class="row">
                                   <div class="col-md-12">
                                             <div class="form-group">
                                                <label class="col-md-3 control-label">主机SN关联:</label>
                                                <div class="col-md-6">
                                                   <select class="selectpicker show-tick bs-select-hidden" data-style="btn-white" name="DockerServer">
                                                       {% for i in ServerData %}
                                                            {% if HostData.host.id == i.id%}
                                                                <option value="{{i.id}}" selected>{{i}}</option>
                                                            {%else%}
                                                                <option value="{{i.id}}" >{{i}}</option>
                                                            {%endif%}
                                                       {%endfor%}
                                                    </select>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-md-3 control-label" for="state-warning">docker主机IP:</label>
                                                <div class="col-md-6">
                                                     <input class="form-control" id="id_dockerip" name="dockerip" value="{{HostData.hostip}}" placeholder="宿主机IP" type="text">
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-md-3 control-label" for="state-danger">docker主机port:</label>
                                                <div class="col-md-6">
                                                    <input class="form-control" id="id_dockerport" name="dockerport" value="{{HostData.port}}" placeholder="宿主机端口" type="text">
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">主机状态: </label>
                                                <div class="col-md-6">
                                                   <select class="form-control" id="id_ServerStatus" name="ServerStatus">
                                                       {% if HostData.enabled == '0' %}
                                                            <option value="0" selected>禁用</option>
                                                            <option value="1">启用</option>
                                                       {%else%}
                                                            <option value="0" >禁用</option>
                                                            <option value="1" selected>启用</option>
                                                       {%endif%}
                                                   </select>
                                                </div>


                                            </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                     <!-- 提交按钮 -->
                    <div>
                        <div class="col-sm-6">
                            <div class="form-group text-right">
                                <button type="submit" class="btn btn-primary">
                                    修改
                                </button>
                            </div>
                        </div>
                    </div>
            </form>
         </div>
</div>
<!--
<script>
    jQuery(document).ready(function(){
               $('button[type=submit]').click(function(e) {
                    e.preventDefault();
                     $.ajax({
                        type: 'POST',
                        url: '{% url "DockerHostAdd" %}',
                        data: $('.form-horizontal').serialize(),
                        success: function(data) {
                           alert(data);
                        },
                        error: function() {},
                    });

               });
    });
</script>-->

<script src="/static/assets/plugins/bootstrap-select/dist/js/bootstrap-select.min.js" type="text/javascript"></script>

{% endblock %}
